package com.cw.jeeyt.service.converter.mdata;
import java.util.List;
import java.util.ArrayList;
import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
import com.cw.jeeyt.service.bo.mdata.MdataBanksBo;
import com.cw.jeeyt.dao.model.mdata.MdataBanksDo;
import com.cw.lang.common.utils.CollectionUtil;
/**
 * 银行转换类
 *
 * @author admin
 * @date 2021-03-26 22:30:39
 */
public class MdataBanksConverter{

    /**
     * do转bo
     * @param model
     * @return
     */
    public static MdataBanksBo do2Bo(MdataBanksDo model) {
		MdataBanksBo bo = new MdataBanksBo();
        if (model == null) {
            return bo;
        }
                bo.setBankId(model.getBankId());
                bo.setBankName(model.getBankName());
                bo.setBankNo(model.getBankNo());
                bo.setBigLogo(model.getBigLogo());
                bo.setClsbank(model.getClsbank());
                bo.setCreateTime(model.getCreateTime());
                bo.setDtype(model.getDtype());
                bo.setRemark(model.getRemark());
                bo.setSmallLogo(model.getSmallLogo());
                bo.setStatus(model.getStatus());
                bo.setTenantId(model.getTenantId());
                bo.setUpdateTime(model.getUpdateTime());
                return bo;
    }

    /**
     * bo转do
     * @param bo
     * @return
     */
    public static MdataBanksDo bo2Do(MdataBanksBo bo) {
		MdataBanksDo model = new MdataBanksDo();
        if (bo == null) {
            return model;
        }
                model.setBankId(bo.getBankId());
                model.setBankName(bo.getBankName());
                model.setBankNo(bo.getBankNo());
                model.setBigLogo(bo.getBigLogo());
                model.setClsbank(bo.getClsbank());
                model.setCreateTime(bo.getCreateTime());
                model.setDtype(bo.getDtype());
                model.setRemark(bo.getRemark());
                model.setSmallLogo(bo.getSmallLogo());
                model.setStatus(bo.getStatus());
                model.setTenantId(bo.getTenantId());
                model.setUpdateTime(bo.getUpdateTime());
                return model;
    }

    /**
     * doList转boList
     * @param doList
     * @return
     */
    public static List<MdataBanksBo> doList2BoList(List<MdataBanksDo> doList) {
        if(CollectionUtil.isEmpty(doList)){
            return new ArrayList<>();
        }
        return Lists.newArrayList(Iterators.transform(doList.iterator(), MdataBanksConverter::do2Bo));
    }

    /**
     * boList转doList
     * @param boList
     * @return
     */
    public static List<MdataBanksDo> boList2DoList(List<MdataBanksBo> boList) {
        if(CollectionUtil.isEmpty(boList)){
            return new ArrayList<>();
        }
        return Lists.newArrayList(Iterators.transform(boList.iterator(), MdataBanksConverter::bo2Do));
    }
}